package br.com.etecmatao.business.impl;

import br.com.etecmatao.business.AbstractBusiness;
import br.com.etecmatao.business.ConversorBusiness;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

public class ConversorBusinessImpl extends AbstractBusiness implements ConversorBusiness{

    public byte[] lerArquivo(String arquivo) {
        FileInputStream fis = null;
        byte[] bytes = null;
        try {
            File file = new File(arquivo);
            fis = new FileInputStream(file);
            bytes = new byte[(int) file.length()];
            fis.read(bytes);
        } catch (FileNotFoundException ex) {
            Logger.getLogger(ConversorBusinessImpl.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(ConversorBusinessImpl.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            try {
                if (fis != null) {
                    fis.close();
                }
            } catch (IOException ex) {
                Logger.getLogger(ConversorBusinessImpl.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        return bytes;
    }
}
